package core

import (
	"base-web/global"
	"github.com/go-redis/redis"
	"github.com/lexkong/log"
)

//初始化redis
func init() {
	redisConf := global.BASE_CONFIG.Redis
	client := redis.NewClient(&redis.Options{
		Addr:     redisConf.Addr,
		Password: redisConf.Password,
		DB:       redisConf.DB,
	})
	_, err := client.Ping().Result()
	if err != nil {
		log.Error("redis ping err", err)
	} else {
		log.Info("redis connect ping success")
		global.BASE_REDIS = client
	}
}
